import QtQuick 2.2
import QtQuick.Window 2.1

Window {
    visible: true
    width: 360
    height: 360

    MouseArea {
        id: ma;
        anchors.fill: parent
    }

    Rectangle {
        id: rect1;
        anchors.fill: parent;
        //和z没关系
        z: ma.z + 1;
    }

    Connections {
        target: ma;
        onClicked: {
            rect1.color = Qt.rgba(Math.random(), Math.random(), Math.random());
        }
    }

}
